init;

% Test isZero
assert(isZero(-1) == 1);
assert(isZero(0) == 0);
assert(isZero(7) == 0);

% Test elementAdd
assert(elementAdd(0,1) == 3);
assert(elementAdd(0,6) == 2);
assert(elementAdd(7,6) == 2);
assert(elementAdd(-1,4) == 4);
assert(elementAdd(1,1) == -1);
assert(elementAdd(3,4) == 6);
assert(elementAdd(10,4) == 6);

% Test elementMult
assert(elementMult(0,3) == 3);
assert(elementMult(2,2) == 4);
assert(elementMult(-1,4) == -1);
assert(elementMult(4,5) == 2);

% Test elementDiv
assert(elementDiv(4,3) == 1);
assert(elementDiv(3,4) == 6);
assert(elementDiv(-1,2) == -1);
try
    elementDiv(3,-1);
catch ME
    flag = 1;
end
assert(flag == 1);
flag = 0;

% Test polyDiv
[q r] = polyDiv([-1],[0 4 2]);
assert(q == -1);
assert(r == -1);
try
    [q r] = polyDiv([3 1],[-1]);
catch ME
    flag = 1;
end
assert(flag == 1);
[q r] = polyDiv([5],[2]);
assert(q == 3);
assert(r == -1);
[q r] = polyDiv([0 -1 -1 0 0 0],[0 -1 0]);
assert(isequal(q,[0 -1 0 0]))
assert(isequal(r,[-1]))
[q r] = polyDiv([3 1 -1 2],[3 -1 2]);
assert(isequal(q,[-1 0]));
assert(isequal(r,[3 0]));
    


